import request from '@/utils/request'

// 查询产品出货列表
export function listChmMstr(query) {
  return request({
    url: '/output/proShipped/list',
    method: 'get',
    params: query
  })
}
// 查询产品出货列表
export function listChdDet(chdDjbh) {
  return request({
    url: '/output/proShipped/listChdDet/'+chdDjbh,
    method: 'get'
  })
}

// 查询产品出货详细
export function getProShipped(chmId) {
  return request({
    url: '/output/proShipped/' + chmId,
    method: 'get'
  })
}

// 新增产品出货
export function addProShipped(data) {
  return request({
    url: '/output/proShipped',
    method: 'post',
    data: data
  })
}

// 修改产品出货
export function updateProShipped(data) {
  return request({
    url: '/output/proShipped',
    method: 'put',
    data: data
  })
}
/** 提交 */
export function submitChm(chmDjbh) {
  return request({
    url: '/output/proShipped/submitChm/' + chmDjbh ,
    method: 'put',
  })
}
/** 审核 */
export function chmMstrCheck(chmDjbh) {
  return request({
    url: '/output/proShipped/checkChm/' + chmDjbh ,
    method: 'put',
  })
}

/** 撤回-开单 */
export function chmMstrBack(chmId,reson) {
  return request({
    url: '/output/proShipped/backChm/' + chmId +'/'+reson ,
    method: 'put',
  })
}
/** 撤回-品管*/
export function chmMstrBackCheck(chmId) {
  return request({
    url: '/output/proShipped/backCheckChm/' + chmId ,
    method: 'put',
  })
}

/** 汇总 */
export function CollectHandle(ckdm,khdm) {
  return request({
    url: '/output/proShipped/collect/' + ckdm + "/" +khdm ,
    method: 'post',
  })
}


/** 过账 */
export function chmMstrPost(chmDjbh) {
  return request({
    url: '/output/proShipped/postChm/' + chmDjbh ,
    method: 'put',
  })
}



// 删除产品出货主表数据
export function delChmMstr(chmDjbh) {
  return request({
    url: '/output/proShipped/' + chmDjbh,
    method: 'delete'
  })
}
// 删除产品出货详细表数据
export function delChdDet(chdId) {
  return request({
    url: '/output/proShipped/delChdDet/' + chdId,
    method: 'delete'
  })
}

/** 获取可接收的数据 */
export function getNeedData(query){
  return request({
    url: '/output/proShipped/getNeedData',
    method: 'get',
    params:query
  })
}


// 导出产品出货
export function exportProShipped(query) {
  return request({
    url: '/output/proShipped/export',
    method: 'get',
    params: query
  })
}

//子表确认
export function sumitChild(data) {
  return request({
    url: '/output/proShipped/addNeedData',
    method: 'post',
    data: data
  })
}



// 报表-查询
export function listData(query) {
  return request({
    url: '/output/chmReport/list',
    method: 'get',
    params: query
  })
}

////报表-导出
export function exportChmReport(query) {
  return request({
    url: '/output/chmReport/export',
    method: 'get',
    params: query
  })
}
